<script type="text/javascript" src="../chart/lib_Tagcloud/swfobject.js"></script>
<script type="text/javascript">
	var content = "<tags>";
<?php

	session_start();
	include_once('../config.php'); 
	LinkDataBase();
	
	$Array_DBTableName = DBTableNameGet($_SESSION['ID'], $_POST['year'], $_POST['season'], $_POST['tablename']);
	$filename = $Array_DBTableName[0];
	
	$sql = "select * from ".$filename." LEFT JOIN sheet ON ".$filename.".table_name = binary(sheet.table_name) 
			WHERE table_number='".$_POST['tablename']."' AND 
			item NOT LIKE '%Base: All Respondents%' AND 
			item NOT LIKE '%Base: Respondents%'";
	
	//Only need Net values.
	if ($_POST['keyword']!='')
		$sql .= " AND item LIKE '%".$_POST['keyword']."%'";
	
	$result= mysql_query($sql);
	while($row = mysql_fetch_assoc($result)) {
		if (($row['item']!="")&&($row['item']!='Sigma')) {
			?>
			content = content +"<a href='#' target='_top' style='20'><?php echo str_replace("'","\'",str_replace('(Net)','',$row['item'])); ?></a>";
            <?php
		}
		else if ($row['item']=='Sigma')
			break;
	}
?>
	content = content + "</tags>";
	var so = new SWFObject("../chart/lib_Tagcloud/tagcloud.swf", "tagcloud", "270", "200", "7", "#ffffff");
	// uncomment next line to enable transparency
	//so.addParam("wmode", "transparent");
	so.addVariable("tcolor", "0x333333");
	so.addVariable("mode", "tags");
	so.addVariable("distr", "true");
	so.addVariable("tspeed", "100");
	so.addVariable("tagcloud", content);
	so.write("<?php echo $_POST['season'].$_POST['tablename']; ?>");
		
</script>

<div id="<?php echo $_POST['season'].$_POST['tablename']; ?>">This will be shown to users with no Flash or Javascript.</div>